# 程序测试入口，main函数
import prettytable as pt
import numpy as np
import listExercise
import rwFile
import FileIniOperation
import typeConversion

# 初始打印，测试pretty table是否安装
def test_Prime():
    print("hello base")
    tb = pt.PrettyTable()
    tb.field_names = ['Author', 'wwcheng']
    tb.add_row(['ID', 'xiaolvshijie'])
    print(tb)

#文件读写测试函数
def test_ReadWriteFile():
    mkfolder = rwFile.mkDir()
    mkfolder.mkdir('linkrecord')
    recordlink = rwFile.RWfile()
    recordlink.recordFile('.\linkrecord\history.txt',
                listExercise.listTest().ListRecord,
                'this is write contents',
                'this is write notes\t')
    print(recordlink.readFile('.\linkrecord\history.txt',
                listExercise.listTest().ListRead))

#列表测试函数
def test_List():
    testlist = listExercise.listTest()
    listg = testlist.TestCreatListGroupRandom(20)
    print(listg)
    testlist.ListSort(listg)
    testlist.TestRange(-2,3,25)
    testlist.TestListAndDict()
    
#进行配置文件测试
def test_Iniconfigfile():
    FileIniOperation.FileOperTest().testConfigRW()

#进行数据类型转换测试
def test_TypeConversion():
    typeConversion.StrtoList().doTest()

#主程序入口
def main():
    # print("this is main")
    # test_Prime()
    # test_List()
    # test_ReadWriteFile()
    # test_Iniconfigfile()
    test_TypeConversion()



if __name__ == '__main__':
    main()